Dynomotion

Group: DynoMotion Message: 9597 From: swarbrick_jon Date: 6/1/2014
Subject: Gecko connected encoder signals

Sorry Tom the questions still abound...


I have 3 Gecko G320s working(mostly) driving X,Y,Z and a pair of Gecko Stepper drivers (mostly working) driving A and B (trunion in the making).


I struggled to get a 4th Step/Dir signal from JP5 whilst Multiplexing is enabled - however no issue I am driving A and B from the last pair on Aux0 and Aux1.


Hopefully that configuration will be evident in the configuration file below.   (I know there is no FPGA(STEP_PULSE_LENGTH_ADD)=  and that there is some dirt in the axis configuration - as I said they are mostly working ).


I need to tune the Geckos better and I need to work through the steps per inch /degree along with acceleration and max speed, but I am VERY HAPPY to have what seems to be mostly co-ordinated motion in 5 axis (BIG SMILEY).


I have had little joy using an oscilloscope on the official test point in the G320, going straight for the Capacitor leg gives something resembling a damped oscillation but I am not content that I can adjust trim pots to make the curve "perfect" and it is awkward to get to the inside of the geckos to go through this when the result seems so hit and miss.


I was hoping to be able to use the Kflop give me a useful output from which I could  tune each of my Gecko's servo loops as a one off/very occasional exercise.  I have been playing on X Axis - Axis Channel 0, Stepper driver 4, trying take the inputs from the encoder that is plugged into the gecko and get them terminated on the Kanalog as well, I have done this on JP1 A0-A0+B0-B0+ but to no avail.  I get no apparent difference in graphing..  There is an  I think that this is Input Channel 0 please confirm?


The A- and B- are bound together at the Gecko on the Enc- terminal.  Do I need to separate the -neg or is there something  more fundamental that I should be doing differently or am I just barking up the wrong tree?


Thanks,


Jon

#include "KMotionDef.h"

// Defines axis 0, 1, 2,3 and 4 as simple step dir outputs
// enables them
// sets them as an xyzab coordinate system for GCode
// well lets hope...

int main()
{
 
 ch0->InputMode=NO_INPUT_MODE;
 ch0->OutputMode=STEP_DIR_MODE;
 ch0->Vel=120000;
 ch0->Accel=12000;
 ch0->Jerk=6000;
 ch0->P=1;
 ch0->I=0;
 ch0->D=0;
 ch0->FFAccel=12000;
 ch0->FFVel=120000;
 ch0->MaxI=200;
 ch0->MaxErr=1e+006;
 ch0->MaxOutput=2000;
 ch0->DeadBandGain=1;
 ch0->DeadBandRange=0;
 ch0->InputChan0=0;
 ch0->InputChan1=0;
 ch0->OutputChan0=4;
 ch0->OutputChan1=1;
 ch0->MasterAxis=-1;
 ch0->LimitSwitchOptions=0x103;
 ch0->LimitSwitchNegBit=138;
 ch0->LimitSwitchPosBit=138;
 ch0->SoftLimitPos=1e+030;
 ch0->SoftLimitNeg=-1e+030;
 ch0->InputGain0=1;
 ch0->InputGain1=1;
 ch0->InputOffset0=0;
 ch0->InputOffset1=0;
 ch0->OutputGain=1;
 ch0->OutputOffset=0;
 ch0->SlaveGain=1;
 ch0->BacklashMode=BACKLASH_OFF;
 ch0->BacklashAmount=0;
 ch0->BacklashRate=0;
 ch0->invDistPerCycle=1;
 ch0->Lead=0;
 ch0->MaxFollowingError=1000000000;
 ch0->StepperAmplitude=20;

 ch0->iir[0].B0=1;
 ch0->iir[0].B1=0;
 ch0->iir[0].B2=0;
 ch0->iir[0].A1=0;
 ch0->iir[0].A2=0;

 ch0->iir[1].B0=1;
 ch0->iir[1].B1=0;
 ch0->iir[1].B2=0;
 ch0->iir[1].A1=0;
 ch0->iir[1].A2=0;

 ch0->iir[2].B0=1;
 ch0->iir[2].B1=0;
 ch0->iir[2].B2=0;
 ch0->iir[2].A1=0;
 ch0->iir[2].A2=0;
 EnableAxis(0);
 

 ch1->InputMode=NO_INPUT_MODE;
 ch1->OutputMode=STEP_DIR_MODE;
 ch1->Vel=100000;
 ch1->Accel=40000;
 ch1->Jerk=400000;
 ch1->P=1;
 ch1->I=0;
 ch1->D=0;
 ch1->FFAccel=10000;
 ch1->FFVel=100000;
 ch1->MaxI=200;
 ch1->MaxErr=1e+006;
 ch1->MaxOutput=200;
 ch1->DeadBandGain=1;
 ch1->DeadBandRange=0;
 ch1->InputChan0=1;
 ch1->InputChan1=1;
 ch1->OutputChan0=5;
 ch1->OutputChan1=3;
 ch1->MasterAxis=-1;
 ch1->LimitSwitchOptions=0x103;
 ch1->LimitSwitchNegBit=137;
 ch1->LimitSwitchPosBit=137;
 ch1->SoftLimitPos=1e+030;
 ch1->SoftLimitNeg=-1e+030;
 ch1->InputGain0=1;
 ch1->InputGain1=1;
 ch1->InputOffset0=0;
 ch1->InputOffset1=0;
 ch1->OutputGain=1;
 ch1->OutputOffset=0;
 ch1->SlaveGain=1;
 ch1->BacklashMode=BACKLASH_OFF;
 ch1->BacklashAmount=0;
 ch1->BacklashRate=0;
 ch1->invDistPerCycle=1;
 ch1->Lead=0;
 ch1->MaxFollowingError=1000000000;
 ch1->StepperAmplitude=20;

 ch1->iir[0].B0=1;
 ch1->iir[0].B1=0;
 ch1->iir[0].B2=0;
 ch1->iir[0].A1=0;
 ch1->iir[0].A2=0;

 ch1->iir[1].B0=1;
 ch1->iir[1].B1=0;
 ch1->iir[1].B2=0;
 ch1->iir[1].A1=0;
 ch1->iir[1].A2=0;

 ch1->iir[2].B0=1;
 ch1->iir[2].B1=0;
 ch1->iir[2].B2=0;
 ch1->iir[2].A1=0;
 ch1->iir[2].A2=0;
 EnableAxis(1);
 

 ch2->InputMode=NO_INPUT_MODE;
 ch2->OutputMode=STEP_DIR_MODE;
 ch2->Vel=60000;
 ch2->Accel=60000;
 ch2->Jerk=30000;
 ch2->P=1;
 ch2->I=0;
 ch2->D=0;
 ch2->FFAccel=30000;
 ch2->FFVel=60000;
 ch2->MaxI=200;
 ch2->MaxErr=1e+006;
 ch2->MaxOutput=200;
 ch2->DeadBandGain=1;
 ch2->DeadBandRange=0;
 ch2->InputChan0=2;
 ch2->InputChan1=2;
 ch2->OutputChan0=6;
 ch2->OutputChan1=5;
 ch2->MasterAxis=-1;
 ch2->LimitSwitchOptions=0x100;
 ch2->LimitSwitchNegBit=136;
 ch2->LimitSwitchPosBit=136;
 ch2->SoftLimitPos=1e+030;
 ch2->SoftLimitNeg=-1e+030;
 ch2->InputGain0=1;
 ch2->InputGain1=1;
 ch2->InputOffset0=0;
 ch2->InputOffset1=0;
 ch2->OutputGain=-1;
 ch2->OutputOffset=0;
 ch2->SlaveGain=1;
 ch2->BacklashMode=BACKLASH_OFF;
 ch2->BacklashAmount=0;
 ch2->BacklashRate=0;
 ch2->invDistPerCycle=1;
 ch2->Lead=0;
 ch2->MaxFollowingError=1000000000;
 ch2->StepperAmplitude=20;

 ch2->iir[0].B0=1;
 ch2->iir[0].B1=0;
 ch2->iir[0].B2=0;
 ch2->iir[0].A1=0;
 ch2->iir[0].A2=0;

 ch2->iir[1].B0=1;
 ch2->iir[1].B1=0;
 ch2->iir[1].B2=0;
 ch2->iir[1].A1=0;
 ch2->iir[1].A2=0;

 ch2->iir[2].B0=1;
 ch2->iir[2].B1=0;
 ch2->iir[2].B2=0;
 ch2->iir[2].A1=0;
 ch2->iir[2].A2=0;
 EnableAxis(2);
 
 ch3->InputMode=NO_INPUT_MODE;
 ch3->OutputMode=STEP_DIR_MODE;
 ch3->Vel=1000;
 ch3->Accel=100;
 ch3->Jerk=4e+006;
 ch3->P=0;
 ch3->I=0.01;
 ch3->D=0;
 ch3->FFAccel=100;
 ch3->FFVel=1000;
 ch3->MaxI=200;
 ch3->MaxErr=1e+006;
 ch3->MaxOutput=10000;
 ch3->DeadBandGain=1;
 ch3->DeadBandRange=0;
 ch3->InputChan0=0;
 ch3->InputChan1=0;
 ch3->OutputChan0=1;
 ch3->OutputChan1=0;
 ch3->MasterAxis=-1;
 ch3->LimitSwitchOptions=0x100;
 ch3->LimitSwitchNegBit=0;
 ch3->LimitSwitchPosBit=0;
 ch3->SoftLimitPos=1e+009;
 ch3->SoftLimitNeg=-1e+009;
 ch3->InputGain0=1;
 ch3->InputGain1=1;
 ch3->InputOffset0=0;
 ch3->InputOffset1=0;
 ch3->OutputGain=1;
 ch3->OutputOffset=0;
 ch3->SlaveGain=1;
 ch3->BacklashMode=BACKLASH_OFF;
 ch3->BacklashAmount=0;
 ch3->BacklashRate=0;
 ch3->invDistPerCycle=1;
 ch3->Lead=0;
 ch3->MaxFollowingError=1000000000;
 ch3->StepperAmplitude=20;

 ch3->iir[0].B0=1;
 ch3->iir[0].B1=0;
 ch3->iir[0].B2=0;
 ch3->iir[0].A1=0;
 ch3->iir[0].A2=0;

 ch3->iir[1].B0=1;
 ch3->iir[1].B1=0;
 ch3->iir[1].B2=0;
 ch3->iir[1].A1=0;
 ch3->iir[1].A2=0;

 ch3->iir[2].B0=0.000769;
 ch3->iir[2].B1=0.001538;
 ch3->iir[2].B2=0.000769;
 ch3->iir[2].A1=1.92081;
 ch3->iir[2].A2=-0.923885;
 EnableAxis(3);

 ch4->InputMode=NO_INPUT_MODE;
 ch4->OutputMode=STEP_DIR_MODE;
 ch4->Vel=4000;
 ch4->Accel=400000;
 ch4->Jerk=4e+006;
 ch4->P=0.2;
 ch4->I=0;
 ch4->D=0;
 ch4->FFAccel=4000;
 ch4->FFVel=4000;
 ch4->MaxI=200;
 ch4->MaxErr=200;
 ch4->MaxOutput=200;
 ch4->DeadBandGain=1;
 ch4->DeadBandRange=0;
 ch4->InputChan0=0;
 ch4->InputChan1=1;
 ch4->OutputChan0=3;
 ch4->OutputChan1=1;
 ch4->MasterAxis=-1;
 ch4->LimitSwitchOptions=0x100;
 ch4->LimitSwitchNegBit=0;
 ch4->LimitSwitchPosBit=0;
 ch4->SoftLimitPos=1e+009;
 ch4->SoftLimitNeg=-1e+009;
 ch4->InputGain0=0;
 ch4->InputGain1=1;
 ch4->InputOffset0=0;
 ch4->InputOffset1=0;
 ch4->OutputGain=1;
 ch4->OutputOffset=0;
 ch4->SlaveGain=1;
 ch4->BacklashMode=BACKLASH_OFF;
 ch4->BacklashAmount=0;
 ch4->BacklashRate=0;
 ch4->invDistPerCycle=1;
 ch4->Lead=0;
 ch4->MaxFollowingError=10000000;
 ch4->StepperAmplitude=250;

 ch4->iir[0].B0=1;
 ch4->iir[0].B1=0;
 ch4->iir[0].B2=0;
 ch4->iir[0].A1=0;
 ch4->iir[0].A2=0;

 ch4->iir[1].B0=1;
 ch4->iir[1].B1=0;
 ch4->iir[1].B2=0;
 ch4->iir[1].A1=0;
 ch4->iir[1].A2=0;

 ch4->iir[2].B0=1;
 ch4->iir[2].B1=0;
 ch4->iir[2].B2=0;
 ch4->iir[2].A1=0;
 ch4->iir[2].A2=0;
 EnableAxis(4);

 DefineCoordSystem6(0,1,2,3,4,-1);

    return 0;
}

Group: DynoMotion Message: 9600 From: Tom Kerekes Date: 6/1/2014
Subject: Re: Gecko connected encoder signals
Hi Jon,

It sounds like you are trying to connect single ended encoders to Kanalog's differential inputs.  That will not work.  See:

http://www.dynomotion.com/faq.html#Encoders_are_counting_inconsistently

Regards
TK